<?php slot('title',sprintf('CorpPon - Payment Information Print- Invoice #'.$invoice->getIdInvoice()))?>
<?php decorate_with(sfConfig::get('sf_apps_dir').'/frontend/templates/print.php');?>
<script type="text/javascript"  language="Javascript">
      function popupPrint(){
        var myWidth = 0;
        var myHeight = 0;
        var popupWidth = 850;
        var popupHeight = 500;
        var screenW = 0;
        var screenH = 0;
        if(document.all){
          screenW = document.body.clientWidth;
          screenH = document.body.clientHeight;
        }else{
          screenW = window.screen.width;
          screenH = window.screen.height;
        }
        if(screenW == 0){
          screenW = popupWidth;
          screenH = popupHeight;
        }

        myWidth = (screenW/2) - ((popupWidth/2) + 10);
        myHeight = (screenH/2) - ((popupHeight/2) + 50);

        // Check for displaying comments
        /*var comments = '&comments=hide';
        if(document.getElementById('showCommentsOnInvoiceChk') && document.getElementById('showCommentsOnInvoiceChk').checked){
          comments = '';
        }*/
        var win2 = window.open("<?php echo url_for('invoices/print?id_invoice='.$invoice->getIdInvoice()) ?>","PrintWindow","status=no,height="+popupHeight+",width="+popupWidth+",resizable=yes,left=" + myWidth + ",top=" + myHeight + ",screenX=" + myWidth + ",screenY=" + myHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
        //win2.focus();
      }
          </script>
<div id="content-wrapper" class="corner">
<table width="750" cellpadding="2" cellspacing="0" border="0" align="center" bgcolor="#DEDEDE">
  <tr>
      <td align="center" valign="top"><br />
<br />
<br />
<img src="/images/logo-corppon-invoice.png" /></td>

    <td valign="top" align="right">
     <table width="300" cellpadding="2" cellspacing="0" style="border: 1px solid #cccccc; ">
      <tr>
        <td bgcolor="#CCCCCC" valign="top">
          <center>
            <font face="arial" size="2"><b>Invoice #<?php echo $invoice->getIdInvoice() ?></b></font>
          </center>
        </td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td height="50"  align="left">
          <center>
            <table cellpadding="2" cellspacing="3" border="0">
              <tr>
                <td align="left">
                  <font face="arial" size="2"><b>Date Created:</b></font>
                </td>
                <td align="left">
                  <font face="arial" size="2">
                    <?php echo date("F j, Y", strtotime($invoice->getCreatedAt())) ?>
                  </font>
                </td>
              </tr>
              <tr>
                <td align="left">
                  <font face="arial" size="2"><b>Date Paid:</b></font>
                </td>
                <td align="left">
                  <font face="arial" size="2">
                    <?php
                      if ($invoice->getPaymentDate()!="") :
                        echo date("F j, Y", strtotime($invoice->getPaymentDate()));
                      else :
                        echo 'No Date registered';
                      endif; ?></font>
                </td>
              </tr>
              <tr>
                <td align="left">
                  <font face="arial" size="2"><b>Transaction Id:</b></font>
                </td>
                <td align="left">
                  <font face="arial" size="2">
                    <?php echo $invoice->getIdTransaction() ?>
                  </font>
                </td>
              </tr>
              <?php if ($sf_user->hasCredential('Admin')) : ?>
              <tr>
                <td align="left">
                  <font face="arial" size="2"><b>Status:</b></font>
                </td>
                <td align="left">
                  <font face="arial" size="2">
                    <?php
                      if ($invoice->getStatus()==1) :
                        echo 'Active';
                      else :
                        echo 'Not Active';
                      endif; ?>
                  </font>
                </td>
              </tr>
              <tr>
                <td align="left">
                  <font face="arial" size="2"><b>Payment:</b></font>
                </td>
                <td align="left">
                  <font face="arial" size="2">
                    <?php
                      if ($invoice->getIsPaid()==1) :
                        echo 'Paid';
                      else :
                        echo 'Not Paid';
                      endif; ?>
                  </font>
                </td>
              </tr>
              <tr>
                <td align="left">
                  <font face="arial" size="2"><b>Authorization Code:</b></font>
                </td>
                <td align="left">
                  <font face="arial" size="2">
                    <?php echo $invoice->getAuthCode(); ?>
                  </font>
                </td>
              </tr>
              <?php endif; ?>
            </table>
          </center>
        </td>
      </tr>
    </table>
    </td>
  </tr>
</table>

<table>

  <tbody>
    <tr>
      <th>Message:</th>
      <td><?php echo $invoice->getMessage() ?></td>
    </tr>



  </tbody>
</table>
<table width="750" cellpadding="10" cellspacing="0" border="0" align="center">
  <tr>
    <td align="left" valign="top" width="400">
      <font face="arial" size="2"><b>Customer Information:</b><br>
        <font face="arial" size="4"><b><?php echo strtoupper($invoice->getBillingName().' '.$invoice->getBillingLastName()) ?></b></font>
        <br>
        <?php if ($invoice->getBillingCompany()!="") :  ?><font face="arial" size="2"><b><?php echo strtoupper($invoice->getBillingCompany()) ?></b></font><?php endif; ?>
        <br>
        <font face="arial" size="2">
          <?php echo strtoupper(str_replace("\n", "<br />", $invoice->getBillingAddress())) ?><br>
          <?php echo strtoupper($invoice->getBillingCity()) ?>, <?php echo strtoupper($invoice->getBillingState()) ?> <?php echo strtoupper($invoice->getBillingZip()) ?><br>
        </font>
        Email: <?php echo $invoice->getBillingEmail() ?>
        <br>
        Phone: <?php echo $invoice->getBillingPhone() ?>
        <br>
        Fax: <?php echo $invoice->getBillingFax() ?>
        <br>
      </font>
    </td>
    <td valign="top" align="right" width="400">
      <font face="arial" size="2"><b>Shipping Address:</b><br>
        <font face="arial" size="4"><b><?php echo strtoupper($invoice->getShippingName().' '.$invoice->getShippingLastName()) ?></b></font>
        <br>
        <?php if ($invoice->getShippingCompany()!="") :  ?><font face="arial" size="2"><b><?php echo strtoupper($invoice->getShippingCompany()) ?></b></font><?php endif; ?>
        <br>
        <font face="arial" size="2"><?php echo strtoupper($invoice->getShippingAddress()) ?></font>
        <br>
        <?php echo $invoice->getShippingCity() ? strtoupper($invoice->getShippingCity()).',' : '' ?> <?php echo strtoupper($invoice->getShippingState()) ?> <?php echo strtoupper($invoice->getShippingZip()) ?>
        <br>
      </font>
    </td>
  </tr>
</table>

<br>

<span class="titulo">
  <b><font face="arial" size="4">Your Bill In Detail</font></b>

</span>
<br>


<table width="750" cellpadding="2" cellspacing="0" style=" " align="center">
  <tr>
    <td align="left" width="350" bgcolor="#DEDEDE" valign="top">
      <font face="arial" size="2"><b>Product</b></font>
    </td>
    <td align="left" width="150" bgcolor="#DEDEDE" valign="top0">
      <font face="arial" size="2"><b>Unit Price</b></font>
    </td>
    <td align="left" width="150" bgcolor="#DEDEDE" valign="top">
      <font face="arial" size="2"><b>Quantity</b></font>
    </td>
    <td align="left" width="100" bgcolor="#DEDEDE" valign="top">
      <font face="arial" size="2"><b>Amount</b></font>
    </td>

  </tr>

  <?php foreach ($products as $product) : ?>
  <tr>
    <td><?php echo $product->Product->getName(); ?></td>
    <td>$<?php echo $product->Product->getDiscountedPrice(); ?></td>
    <td><?php echo $product->getProductQuantity(); ?></td>
    <td>$<?php echo number_format($product->getProductQuantity()*$product->Product->getDiscountedPrice(),2) ?></td>
  </tr>
  <?php endforeach; ?>
</table>
<center>
<hr width="800" size="1">

  <br>
  <table width="750" cellpadding="2" cellspacing="1" style=" " align="center">
  <tr>
    <td width="350" valign="top">&nbsp;</td>
    <td width="150" valign="top0">&nbsp;</td>
    <td align="left" width="150" valign="top">
      <font face="arial" size="2"><b>SubTotal</b></font>
    </td>
    <td align="left" width="100" valign="top">
      <font face="arial" size="2">
        $<?php echo number_format($invoice->getInvoiceAmount()-($invoice->getShippingAmount()+$invoice->getTaxAmount()), 2) ?>
      </font>
    </td>
  </tr>
</table>
  <table width="750" cellpadding="2" cellspacing="1" style=" " align="center">
  <tr>
    <td width="350" valign="top">&nbsp;</td>
    <td width="150" valign="top0">&nbsp;</td>
    <td align="left" width="150" valign="top">
      <font face="arial" size="2"><b>Shipping Amount</b></font>
    </td>
    <td align="left" width="100" valign="top">
      <font face="arial" size="2">
        $<?php echo number_format($invoice->getShippingAmount(), 2) ?>
      </font>
    </td>
  </tr>
</table>
  <table width="750" cellpadding="2" cellspacing="1" style=" " align="center">
  <tr>
    <td width="350" valign="top">&nbsp;</td>
    <td width="150" valign="top0">&nbsp;</td>
    <td align="left" width="150" valign="top">
      <font face="arial" size="2"><b>Tax Amount</b></font>
    </td>
    <td align="left" width="100" valign="top">
      <font face="arial" size="2">
        $<?php echo number_format($invoice->getTaxAmount(), 2) ?>
      </font>
    </td>
  </tr>
</table>
  <table width="750" cellpadding="2" cellspacing="1" style=" " align="center">
  <tr>
    <td width="350" valign="top">&nbsp;</td>
    <td width="150" valign="top">&nbsp;</td>
    <td align="left" width="150" valign="top">
      <font face="arial" size="4"><b>Total amount</b></font>
    </td>
    <td align="left" width="100" valign="top">
      <font face="arial" size="4">
        <b>$<?php echo number_format($invoice->getInvoiceAmount(), 2) ?></b>
      </font>
    </td>
  </tr>
</table>
<hr width="800" size="1">
  <center>
    <b><font face="arial" size="4">Thank You for Your Purchase!</font></b><br>
    <br>
    <hr width="800" size="1">
    <center>
    <br>
      <center>
        <font face="arial" size="2"></font>
      </center>
    </center>
  </center>
</center>

</div>